3.60 \(\int (c+d x) (a+b \tanh (e+f x))^2 \, dx\)

Optimal. Leaf size=127 \[ \frac {a^2 (c+d x)^2}{2 d}+\frac {2 a b (c+d x) \log \left (e^{2 (e+f x)}+1\right )}{f}-\frac {a b (c+d x)^2}{d}+\frac {a b d \text {Li}_2\left (-e^{2 (e+f x)}\right )}{f^2}-\frac {b^2 (c+d x) \tanh (e+f x)}{f}+b^2 c x+\frac {b^2 d \log (\cosh (e+f x))}{f^2}+\frac {1}{2} b^2 d x^2 \]

[Out]

b^2*c*x+1/2*b^2*d*x^2+1/2*a^2*(d*x+c)^2/d-a*b*(d*x+c)^2/d+2*a*b*(d*x+c)*ln(1+exp(2*f*x+2*e))/f+b^2*d*ln(cosh(f
*x+e))/f^2+a*b*d*polylog(2,-exp(2*f*x+2*e))/f^2-b^2*(d*x+c)*tanh(f*x+e)/f

________________________________________________________________________________________

Rubi [A]  time = 0.18, antiderivative size = 127, normalized size of antiderivative = 1.00, number of steps used = 9, number of rules used = 7, integrand size = 18, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.389, Rules used = {3722, 3718, 2190, 2279, 2391, 3720, 3475} \[ \frac {a b d \text {PolyLog}\left (2,-e^{2 (e+f x)}\right )}{f^2}+\frac {a^2 (c+d x)^2}{2 d}+\frac {2 a b (c+d x) \log \left (e^{2 (e+f x)}+1\right )}{f}-\frac {a b (c+d x)^2}{d}-\frac {b^2 (c+d x) \tanh (e+f x)}{f}+b^2 c x+\frac {b^2 d \log (\cosh (e+f x))}{f^2}+\frac {1}{2} b^2 d x^2 \]

Antiderivative was successfully verified.

[In]

Int[(c + d*x)*(a + b*Tanh[e + f*x])^2,x]

[Out]

b^2*c*x + (b^2*d*x^2)/2 + (a^2*(c + d*x)^2)/(2*d) - (a*b*(c + d*x)^2)/d + (2*a*b*(c + d*x)*Log[1 + E^(2*(e + f
*x))])/f + (b^2*d*Log[Cosh[e + f*x]])/f^2 + (a*b*d*PolyLog[2, -E^(2*(e + f*x))])/f^2 - (b^2*(c + d*x)*Tanh[e +
 f*x])/f

Rule 2190

Int[(((F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)*((c_.) + (d_.)*(x_))^(m_.))/((a_) + (b_.)*((F_)^((g_.)*((e_.) +
 (f_.)*(x_))))^(n_.)), x_Symbol] :> Simp[((c + d*x)^m*Log[1 + (b*(F^(g*(e + f*x)))^n)/a])/(b*f*g*n*Log[F]), x]
 - Dist[(d*m)/(b*f*g*n*Log[F]), Int[(c + d*x)^(m - 1)*Log[1 + (b*(F^(g*(e + f*x)))^n)/a], x], x] /; FreeQ[{F,
a, b, c, d, e, f, g, n}, x] && IGtQ[m, 0]

Rule 2279

Int[Log[(a_) + (b_.)*((F_)^((e_.)*((c_.) + (d_.)*(x_))))^(n_.)], x_Symbol] :> Dist[1/(d*e*n*Log[F]), Subst[Int
[Log[a + b*x]/x, x], x, (F^(e*(c + d*x)))^n], x] /; FreeQ[{F, a, b, c, d, e, n}, x] && GtQ[a, 0]

Rule 2391

Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_.))]/(x_), x_Symbol] :> -Simp[PolyLog[2, -(c*e*x^n)]/n, x] /; FreeQ[{c, d,
 e, n}, x] && EqQ[c*d, 1]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3718

Int[((c_.) + (d_.)*(x_))^(m_.)*tan[(e_.) + (Complex[0, fz_])*(f_.)*(x_)], x_Symbol] :> -Simp[(I*(c + d*x)^(m +
 1))/(d*(m + 1)), x] + Dist[2*I, Int[((c + d*x)^m*E^(2*(-(I*e) + f*fz*x)))/(1 + E^(2*(-(I*e) + f*fz*x))), x],
x] /; FreeQ[{c, d, e, f, fz}, x] && IGtQ[m, 0]

Rule 3720

Int[((c_.) + (d_.)*(x_))^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[(b*(c + d*x)^m*(b*Tan[e
 + f*x])^(n - 1))/(f*(n - 1)), x] + (-Dist[(b*d*m)/(f*(n - 1)), Int[(c + d*x)^(m - 1)*(b*Tan[e + f*x])^(n - 1)
, x], x] - Dist[b^2, Int[(c + d*x)^m*(b*Tan[e + f*x])^(n - 2), x], x]) /; FreeQ[{b, c, d, e, f}, x] && GtQ[n,
1] && GtQ[m, 0]

Rule 3722

Int[((c_.) + (d_.)*(x_))^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Int[ExpandIntegrand[
(c + d*x)^m, (a + b*Tan[e + f*x])^n, x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && IGtQ[m, 0] && IGtQ[n, 0]

Rubi steps

\begin {align*} \int (c+d x) (a+b \tanh (e+f x))^2 \, dx &=\int \left (a^2 (c+d x)+2 a b (c+d x) \tanh (e+f x)+b^2 (c+d x) \tanh ^2(e+f x)\right ) \, dx\\ &=\frac {a^2 (c+d x)^2}{2 d}+(2 a b) \int (c+d x) \tanh (e+f x) \, dx+b^2 \int (c+d x) \tanh ^2(e+f x) \, dx\\ &=\frac {a^2 (c+d x)^2}{2 d}-\frac {a b (c+d x)^2}{d}-\frac {b^2 (c+d x) \tanh (e+f x)}{f}+(4 a b) \int \frac {e^{2 (e+f x)} (c+d x)}{1+e^{2 (e+f x)}} \, dx+b^2 \int (c+d x) \, dx+\frac {\left (b^2 d\right ) \int \tanh (e+f x) \, dx}{f}\\ &=b^2 c x+\frac {1}{2} b^2 d x^2+\frac {a^2 (c+d x)^2}{2 d}-\frac {a b (c+d x)^2}{d}+\frac {2 a b (c+d x) \log \left (1+e^{2 (e+f x)}\right )}{f}+\frac {b^2 d \log (\cosh (e+f x))}{f^2}-\frac {b^2 (c+d x) \tanh (e+f x)}{f}-\frac {(2 a b d) \int \log \left (1+e^{2 (e+f x)}\right ) \, dx}{f}\\ &=b^2 c x+\frac {1}{2} b^2 d x^2+\frac {a^2 (c+d x)^2}{2 d}-\frac {a b (c+d x)^2}{d}+\frac {2 a b (c+d x) \log \left (1+e^{2 (e+f x)}\right )}{f}+\frac {b^2 d \log (\cosh (e+f x))}{f^2}-\frac {b^2 (c+d x) \tanh (e+f x)}{f}-\frac {(a b d) \operatorname {Subst}\left (\int \frac {\log (1+x)}{x} \, dx,x,e^{2 (e+f x)}\right )}{f^2}\\ &=b^2 c x+\frac {1}{2} b^2 d x^2+\frac {a^2 (c+d x)^2}{2 d}-\frac {a b (c+d x)^2}{d}+\frac {2 a b (c+d x) \log \left (1+e^{2 (e+f x)}\right )}{f}+\frac {b^2 d \log (\cosh (e+f x))}{f^2}+\frac {a b d \text {Li}_2\left (-e^{2 (e+f x)}\right )}{f^2}-\frac {b^2 (c+d x) \tanh (e+f x)}{f}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 2.45, size = 192, normalized size = 1.51 \[ \frac {\cosh (e+f x) (a+b \tanh (e+f x))^2 \left (\cosh (e+f x) \left (-\left ((e+f x) \left (a^2 (-2 c f+d e-d f x)-2 a b d (e+f x)+b^2 (-2 c f+d e-d f x)\right )\right )+2 b \log (\cosh (e+f x)) (2 a c f-2 a d e+b d)+4 a b d (e+f x) \log \left (e^{-2 (e+f x)}+1\right )\right )-2 a b d \text {Li}_2\left (-e^{-2 (e+f x)}\right ) \cosh (e+f x)-2 b^2 f (c+d x) \sinh (e+f x)\right )}{2 f^2 (a \cosh (e+f x)+b \sinh (e+f x))^2} \]

Antiderivative was successfully verified.

[In]

Integrate[(c + d*x)*(a + b*Tanh[e + f*x])^2,x]

[Out]

(Cosh[e + f*x]*(Cosh[e + f*x]*(-((e + f*x)*(-2*a*b*d*(e + f*x) + a^2*(d*e - 2*c*f - d*f*x) + b^2*(d*e - 2*c*f
- d*f*x))) + 4*a*b*d*(e + f*x)*Log[1 + E^(-2*(e + f*x))] + 2*b*(b*d - 2*a*d*e + 2*a*c*f)*Log[Cosh[e + f*x]]) -
 2*a*b*d*Cosh[e + f*x]*PolyLog[2, -E^(-2*(e + f*x))] - 2*b^2*f*(c + d*x)*Sinh[e + f*x])*(a + b*Tanh[e + f*x])^
2)/(2*f^2*(a*Cosh[e + f*x] + b*Sinh[e + f*x])^2)

________________________________________________________________________________________

fricas [C]  time = 1.00, size = 944, normalized size = 7.43 \[ \text {result too large to display} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)*(a+b*tanh(f*x+e))^2,x, algorithm="fricas")

[Out]

1/2*((a^2 - 2*a*b + b^2)*d*f^2*x^2 + 4*a*b*d*e^2 + 2*(a^2 - 2*a*b + b^2)*c*f^2*x - 4*b^2*d*e + ((a^2 - 2*a*b +
 b^2)*d*f^2*x^2 + 4*a*b*d*e^2 - 8*a*b*c*e*f - 4*b^2*d*e - 2*(2*b^2*d*f - (a^2 - 2*a*b + b^2)*c*f^2)*x)*cosh(f*
x + e)^2 + 2*((a^2 - 2*a*b + b^2)*d*f^2*x^2 + 4*a*b*d*e^2 - 8*a*b*c*e*f - 4*b^2*d*e - 2*(2*b^2*d*f - (a^2 - 2*
a*b + b^2)*c*f^2)*x)*cosh(f*x + e)*sinh(f*x + e) + ((a^2 - 2*a*b + b^2)*d*f^2*x^2 + 4*a*b*d*e^2 - 8*a*b*c*e*f
- 4*b^2*d*e - 2*(2*b^2*d*f - (a^2 - 2*a*b + b^2)*c*f^2)*x)*sinh(f*x + e)^2 - 4*(2*a*b*c*e - b^2*c)*f + 4*(a*b*
d*cosh(f*x + e)^2 + 2*a*b*d*cosh(f*x + e)*sinh(f*x + e) + a*b*d*sinh(f*x + e)^2 + a*b*d)*dilog(I*cosh(f*x + e)
 + I*sinh(f*x + e)) + 4*(a*b*d*cosh(f*x + e)^2 + 2*a*b*d*cosh(f*x + e)*sinh(f*x + e) + a*b*d*sinh(f*x + e)^2 +
 a*b*d)*dilog(-I*cosh(f*x + e) - I*sinh(f*x + e)) - 2*(2*a*b*d*e - 2*a*b*c*f - b^2*d + (2*a*b*d*e - 2*a*b*c*f
- b^2*d)*cosh(f*x + e)^2 + 2*(2*a*b*d*e - 2*a*b*c*f - b^2*d)*cosh(f*x + e)*sinh(f*x + e) + (2*a*b*d*e - 2*a*b*
c*f - b^2*d)*sinh(f*x + e)^2)*log(cosh(f*x + e) + sinh(f*x + e) + I) - 2*(2*a*b*d*e - 2*a*b*c*f - b^2*d + (2*a
*b*d*e - 2*a*b*c*f - b^2*d)*cosh(f*x + e)^2 + 2*(2*a*b*d*e - 2*a*b*c*f - b^2*d)*cosh(f*x + e)*sinh(f*x + e) +
(2*a*b*d*e - 2*a*b*c*f - b^2*d)*sinh(f*x + e)^2)*log(cosh(f*x + e) + sinh(f*x + e) - I) + 4*(a*b*d*f*x + a*b*d
*e + (a*b*d*f*x + a*b*d*e)*cosh(f*x + e)^2 + 2*(a*b*d*f*x + a*b*d*e)*cosh(f*x + e)*sinh(f*x + e) + (a*b*d*f*x
+ a*b*d*e)*sinh(f*x + e)^2)*log(I*cosh(f*x + e) + I*sinh(f*x + e) + 1) + 4*(a*b*d*f*x + a*b*d*e + (a*b*d*f*x +
 a*b*d*e)*cosh(f*x + e)^2 + 2*(a*b*d*f*x + a*b*d*e)*cosh(f*x + e)*sinh(f*x + e) + (a*b*d*f*x + a*b*d*e)*sinh(f
*x + e)^2)*log(-I*cosh(f*x + e) - I*sinh(f*x + e) + 1))/(f^2*cosh(f*x + e)^2 + 2*f^2*cosh(f*x + e)*sinh(f*x +
e) + f^2*sinh(f*x + e)^2 + f^2)

________________________________________________________________________________________

giac [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int {\left (d x + c\right )} {\left (b \tanh \left (f x + e\right ) + a\right )}^{2}\,{d x} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)*(a+b*tanh(f*x+e))^2,x, algorithm="giac")

[Out]

integrate((d*x + c)*(b*tanh(f*x + e) + a)^2, x)

________________________________________________________________________________________

maple [A]  time = 0.41, size = 221, normalized size = 1.74 \[ \frac {a^{2} d \,x^{2}}{2}-a b d \,x^{2}+\frac {b^{2} d \,x^{2}}{2}+a^{2} c x +2 c a b x +b^{2} c x +\frac {2 b^{2} \left (d x +c \right )}{f \left ({\mathrm e}^{2 f x +2 e}+1\right )}+\frac {b^{2} d \ln \left ({\mathrm e}^{2 f x +2 e}+1\right )}{f^{2}}-\frac {2 b^{2} d \ln \left ({\mathrm e}^{f x +e}\right )}{f^{2}}-\frac {4 b a c \ln \left ({\mathrm e}^{f x +e}\right )}{f}+\frac {2 b a c \ln \left ({\mathrm e}^{2 f x +2 e}+1\right )}{f}+\frac {4 b d a e \ln \left ({\mathrm e}^{f x +e}\right )}{f^{2}}-\frac {4 b a d e x}{f}-\frac {2 b a d \,e^{2}}{f^{2}}+\frac {2 b \ln \left ({\mathrm e}^{2 f x +2 e}+1\right ) a d x}{f}+\frac {a b d \polylog \left (2, -{\mathrm e}^{2 f x +2 e}\right )}{f^{2}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((d*x+c)*(a+b*tanh(f*x+e))^2,x)

[Out]

1/2*a^2*d*x^2-a*b*d*x^2+1/2*b^2*d*x^2+a^2*c*x+2*c*a*b*x+b^2*c*x+2/f*b^2*(d*x+c)/(exp(2*f*x+2*e)+1)+1/f^2*b^2*d
*ln(exp(2*f*x+2*e)+1)-2/f^2*b^2*d*ln(exp(f*x+e))-4/f*b*a*c*ln(exp(f*x+e))+2/f*b*a*c*ln(exp(2*f*x+2*e)+1)+4/f^2
*b*d*a*e*ln(exp(f*x+e))-4/f*b*a*d*e*x-2/f^2*b*a*d*e^2+2/f*b*ln(exp(2*f*x+2*e)+1)*a*d*x+a*b*d*polylog(2,-exp(2*
f*x+2*e))/f^2

________________________________________________________________________________________

maxima [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \frac {1}{2} \, a^{2} d x^{2} + {\left (x^{2} - 4 \, \int \frac {x}{e^{\left (2 \, f x + 2 \, e\right )} + 1}\,{d x}\right )} a b d + b^{2} c {\left (x + \frac {e}{f} - \frac {2}{f {\left (e^{\left (-2 \, f x - 2 \, e\right )} + 1\right )}}\right )} + a^{2} c x + \frac {1}{2} \, b^{2} d {\left (\frac {f x^{2} + {\left (f x^{2} e^{\left (2 \, e\right )} - 4 \, x e^{\left (2 \, e\right )}\right )} e^{\left (2 \, f x\right )}}{f e^{\left (2 \, f x + 2 \, e\right )} + f} + \frac {2 \, \log \left ({\left (e^{\left (2 \, f x + 2 \, e\right )} + 1\right )} e^{\left (-2 \, e\right )}\right )}{f^{2}}\right )} + \frac {2 \, a b c \log \left (\cosh \left (f x + e\right )\right )}{f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)*(a+b*tanh(f*x+e))^2,x, algorithm="maxima")

[Out]

1/2*a^2*d*x^2 + (x^2 - 4*integrate(x/(e^(2*f*x + 2*e) + 1), x))*a*b*d + b^2*c*(x + e/f - 2/(f*(e^(-2*f*x - 2*e
) + 1))) + a^2*c*x + 1/2*b^2*d*((f*x^2 + (f*x^2*e^(2*e) - 4*x*e^(2*e))*e^(2*f*x))/(f*e^(2*f*x + 2*e) + f) + 2*
log((e^(2*f*x + 2*e) + 1)*e^(-2*e))/f^2) + 2*a*b*c*log(cosh(f*x + e))/f

________________________________________________________________________________________

mupad [F]  time = 0.00, size = -1, normalized size = -0.01 \[ \int {\left (a+b\,\mathrm {tanh}\left (e+f\,x\right )\right )}^2\,\left (c+d\,x\right ) \,d x \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + b*tanh(e + f*x))^2*(c + d*x),x)

[Out]

int((a + b*tanh(e + f*x))^2*(c + d*x), x)

________________________________________________________________________________________

sympy [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int \left (a + b \tanh {\left (e + f x \right )}\right )^{2} \left (c + d x\right )\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)*(a+b*tanh(f*x+e))**2,x)

[Out]

Integral((a + b*tanh(e + f*x))**2*(c + d*x), x)

________________________________________________________________________________________